<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>GT pro钱包</title>
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
		<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
		<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
		<link rel="stylesheet" href="dist/css/skins/skin-blue.min.css">
		<link rel="stylesheet" href="css/style.css">
		<link rel="stylesheet" href="css/card.css">
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

		<link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css">
		<link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
		<style>
			.data_remark {
				border: 1px solid #eee;
				width: auto;
				height:30px;
				padding:5px;
			}
		</style>
	</head>

	<body class="hold-transition skin-blue sidebar-mini">
		<div class="wrapper">
			<div class="content-wrapper">
				<section class="content-header">
					<ol class="breadcrumb">
						<li>
							<a href="#"><i class="fa fa-dashboard"></i>质押引力池管理</a>
						</li>
						<li class="active">邀请层级查询</li>
					</ol>
				</section>
				<section class="content">
					<div class="box">
						<div class="box-header with-border">
							邀请层级查询
						</div>
						<div class="box-body">
							<div class="buyu_search_group">
								<div class="row" style="margin-bottom:10px;">
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<div class="input-group margin">
											<div class="input-group-btn">
												<!-- id，购买算力用户，购买算力，层级，获取用户，网络算力，时间 -->
												<button type="button" class="btn btn-default" aria-expanded="false">用户id</button>
											</div>
											<input type="text" class="form-control" id="user_id">
										</div>
									</div>
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<div class="input-group margin">
											<div class="input-group-btn">
												<!-- id，购买算力用户，购买算力，层级，获取用户，网络算力，时间 -->
												<button type="button" class="btn btn-default" aria-expanded="false">状态</button>
											</div>
											<select type="text" class="form-control statusList" id="status">
												<option value="">全部</option>
											</select>
										</div>
									</div>
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<div class="input-group margin">
											<div class="input-group-btn">
												<button type="button" class="btn btn-default" aria-expanded="false">时间</button>
											</div>
											<!-- /btn-group -->
											<input type="text" class="form-control" id="select_time" autocomplete="off">
											<div class="input-group-addon clearBtns" onclick="clearRangeTime(this)">x</div>
										</div>
									</div>
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<button type="button" class="btn bg-primary margin" onclick="search()"><i class="fa fa-search" ></i>&nbsp;搜索</button>
										<!-- <button type="button" class="btn bg-primary margin" onclick="batchBlack()"><i class="fa fa-trash" ></i>&nbsp;批量拉黑</button> -->
									</div>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<!-- /.box-header -->
								<div class="box-body">
									<table id="example" class="display nowrap table table-bordered table-striped" style="width:100%;">
										<thead>
											<tr>
												<th>ID</th>
												<th>用户</th>
												<th>质押数量</th>
												<th>状态</th>
												<th>时间</th>
											</tr>
										</thead>
										<tbody></tbody>
									</table>
									<div class="dealSum clearfix" >
										<div style="float:left">
											质押总数：<span id="joinSum">--</span>
										</div>
										
									</div>
								</div>
							</div>
						</div>
					</div>
					</section>
			</div>
		</div>

		<script src="bower_components/jquery/dist/jquery.min.js"></script>
		<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
		<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>

		<script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
		<script src="bower_components/moment/min/moment.min.js"></script>
		<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>

		<script src="dist/js/adminlte.min.js"></script>
		<script src="js/argument.js"></script>
		<script src="js/fun.js"></script>
		<script src="js/buyu_fun.js"></script>
		<script src="js/nav.js"></script>
		<script src="js/pop.js"></script>
		<script src="js/getList.js"></script>
		<script type="text/javascript">
			var statusList = {
				 0:{text:'进行中',color:'info'},    
				 2:{text:'已解押',color:'danger'},
			}
			$.each(statusList,function(index,item){
				$(".statusList").append('<option value="'+index+'">'+item.text+'</option>')
			})
			
			$('#select_time').daterangepicker({
				timePicker: true,
				timePicker24Hour: true,
				autoUpdateInput: false,
				locale: {
					format: "YYYY-MM-DD HH:mm"
				}
			})

			var table = $('#example').DataTable({
				'ordering': false,
				'lengthChange': false,
				'searching': false,
				'info': true,
				"processing": true,
				"serverSide": true,
				'scrollX': true,
				"ajax": {
					"type": 'post',
					"url": url + "Back_JoinHoistory",
					"contentType": "application/x-www-form-urlencoded",
					"headers": {
						"auth-token": localStorage.getItem("wallet_token")
					},
					"data": function(d) {
						$("[name = allcheck]").prop('checked', false);
						var dataType = {
							user_id: {
								type: 'string',
								value: $("#user_id").val()
							},
							status: {
								type: 'string',
								value: $("#status").val()
							},
							start_time: {
								type: 'time',
								value: $("#select_time").val().substring(0, 16)
							},
							end_time: {
								type: 'time',
								value: $("#select_time").val().substring(19, 35)
							}
						}
						var Json = renderData(dataType);
						Json.page_num = d.start / 10 + 1;
						var data = {};
						data.data = JSON.stringify(Json);
						return data;
					},
					"dataFilter": function(data) {
						var datajson = eval('(' + data + ')');
						if(datajson.status == 1000||datajson.status == 102) {
							ToLogin(datajson)
							return false;
						} else if(datajson.status != 1) {
							alert(datajson.error);
							return false;
						}
						var json = {};
						
						$('#joinSum').text(datajson.data.joinSum)
						if(datajson.data == null) {
							json.recordsTotal = 0;
							json.recordsFiltered = 0;
							json.data = [];
							return JSON.stringify(json);
						} else {
							json.recordsTotal = datajson.data.total;
							json.recordsFiltered = datajson.data.total;
							json.data = datajson.data.data_list;
							return JSON.stringify(json);
						}
					}
				},
				"columns": [
					//id，用户，质押数量(如：100 GT)，状态，时间
					
					{
						data: 'id'
					},
					{
						data: 'user_id'
					},
					{
						data:null,render:function(data){
							return '<i class="fa fa-fw fa-database"></i>' + data.number +' '+ data.coin_name
						} 
					},
					{
						data: null,render:function(data){
							return '<small class="label label-'+statusList[data.status].color+'">'+statusList[data.status].text+'</small>'
						}
					},
					{
						data: 'join_time'
					},
				]
			})
		</script>
		</body>

</html>